<?php
include_once(dirname(__FILE__)."/../inc/common.php");

$accountClass = new tally_account();
$accountList = $accountClass->findAccountList($userId);
?>
<div class="titlebar">
	<h3>记账-收支明细</h3>
</div>
<!-- begin:搜索区 -->
<div class="tab_wrapper">
	<div class="body">
		<div class="toolbar">
			<p>
				<a class="button" title="记收入"  href="javascript:fGoto();" onclick="Income.goAdd('11','');CM.afterSubmit=Flow.searchByCategory;CM.afterSubmit0=Tally.loadBoard;"><span>记收入</span></a>
				<a class="button" title="记支出"  href="javascript:fGoto();" onclick="Expense.goAdd('20','');CM.afterSubmit=Flow.searchByCategory;CM.afterSubmit0=Tally.loadBoard;"><span>记支出</span></a>
			</p>
		</div>
		<form id="flowSchForm" name="flowSchForm"  method="post">
			<div class="searchbar" id ="searchbar">
				<div class="base_condition">
					<table>
						<tr>
							<td><SELECT id ="dateSpan" NAME="dateSpan" onChange="updateDate('dateSpan','dateFrom','dateTo');">
									<option value="" selected>日期</option>
									<option value="today">今日</option>
									<option value="theWeek">本周</option>
									<option value="theMonth">本月</option>
									<option value="theQuarter">本季度</option>
									<option value="theYear">今年</option>
									<option value="lastWeek">上周</option>
									<option value="lastMonth">上月</option>
									<option value="lastQuarter">上季度</option>
									<option value="lastYear">去年</option>
									<option value="last7Day">近7天</option>
									<option value="last30Day">近30天</option>
									<option value="custom">自定义</option>
								</SELECT>
								从<INPUT class="Wdate date" TYPE="text" id="dateFrom" NAME="dateFrom" onFocus="WdatePicker();" value="" onChange="updateType('dateSpan');">
								至<INPUT class="Wdate date" TYPE="text" id="dateTo" NAME="dateTo" onFocus="WdatePicker();" value="" onChange="updateType('dateSpan');">
							</td>
                            <td>
                                <select name="inOrOut">
                                    <option value="">所有</option>
                                    <option value="3">收入</option>
                                    <option value="4">支出</option>
                                    <option value="2">转账</option>
                                </select>
                            </td>
							<td>
								<select name="orderField">
									<option value="vc.trade_time desc,vc.voucher_id desc">排序方式</option>
									<option value="en.amount desc">金额从大到小</option>
									<option value="en.amount asc">金额从小到大</option>
									<option value="vc.trade_time desc,vc.voucher_id desc">日期由近及远</option>
									<option value="vc.trade_time asc,vc.voucher_id asc">日期由远及近</option>
								</select>
							</td>
						</tr>
					</table>
				</div>
				<table class="complex_condition">
					<tr>
						<td>
							<label for="categoryName">
								账户:
							</label>
						</td>
						<td>
							<select class="m" name="accountId"  id="accountId" notnull="true" >
								<option value="">全部</option>

								<?php
								foreach($accountList as $account){
								?>
								<option value="<?php echo $account["id"];?>"><?php echo $account["name"];?></option>
								<?php
								}
								?>


							</select>
						</td>
						<td><label for="tagId">标签:</label></td>
						<td>
							<input type="hidden" id="tagId" name="tagId" value=""/>
							<input type="text" class="text rd" id="tagName" name="tagName" readonly="readonly" onclick="CM.clearValue(this);">
							<a title="选择标签" href="javascript:fGoto();" onclick="TagPicker.open(this);return false;"><img src="../images/icons/select.gif" align="absmiddle"/></a>
						</td>
						<td><label for="remark">说明:</label></td>
						<td><input id="remark" name="remark" class="text" type="text" value=""></td>
						<td>
							<input id="searchBtn" class="button" type="button" value="查询" onclick="Flow.searchByCategory();"/>
							<input type="hidden" id="subjectId" name="subjectId" clear="true" />
							<input type="hidden" id="subjectCate" name="subjectCate" value=""/>
						</td>
					</tr>
				</table>
			</div>
		</form>
		<div id="dataView" class="data" >
			<div  align="center"></div>
		</div>
		<!-- end:---------主数据区 -->
	</div>
</div>
